<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html>
	<head>
		<title>用户管理</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">     
			$(function(){ 
				var defHeight = 300,wh=$(window).height();
				var lh=$('.location').height(),fh=$('#floatHead').height(),sh=$('.det-list').height(),ph=$('.pagelist').height();
				defHeight = (wh-lh-fh-sh-ph-130);
				$('.flexgrid').flexigrid({striped:true,height:defHeight});
			});
			
			function page(n,s){
				$("#pageNo").val(n);
				$("#pageSize").val(s);
				$("#searchForm").submit();
	        	return false;
	        }
	        
	        function deleteAll(){
				var ids =[];//定义一个数组    
	            $('input[name="checkall"]:checked').each(function(){    
	                ids.push($.trim($(this).val()));
	            });
	            document.location.href='${ctx}/sd/section/delete?ids='+ids;
			}
		</script>
		<style type="text/css">
	
			.section-table{
				padding-top:3px;
				padding-left:10px;
				background-color: #fffcd3;
				float:left;
				font-size: 15px;
			}
			.section-table-p1{
				text-align:right;
				color: #000080;
				font-family: Verdana;
			}
			
			.section-table-p2{
				text-align:right;
				color: #483D8B;
				font-family: Geneva;
			}
			
		</style>
	</head>
	<body>
		<sys:message content="${message}"/>
		<!--导航栏-->
		<div class="location">
			<a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
			<a href="${ctx}/center" class="home"><i></i>
			<span>首页</span></a> 
			<i class="arrow"></i> 
			<span>奖品设置</span>
		</div>
		<!--/导航栏-->

		<!--工具栏-->
		<div id="floatHead" class="toolbar-wrap">
			<div class="toolbar">
				<div class="box-wrap">
					<a class="menu-btn"></a>
					<div class="l-list">
						<ul class="icon-list">
							<li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
								<shiro:hasPermission name="sd:section:add">
									<li><a class="add" href="${ctx}/sd/section/form"><i></i><span>新增</span></a></li>
								</shiro:hasPermission>
								<shiro:hasPermission name="sd:section:delete">
									<li><a id="btnDelete" class="del" href="${ctx}/sd/section/delete?id=${section.id}" onclick="return confirma('确认要删除该奖品设置吗？', deleteAll)"><i></i><span>删除</span></a></li>
								</shiro:hasPermission>
						</ul>
					</div>
					<div class="r-list" style="display:none;">
						<input name="txtKeywords" type="text" id="txtKeywords" class="keyword" /> 
						<a id="lbtnSearch" class="btn-search" href="javascript:void(0)">查询</a>
					</div>
				</div>
			</div>
		</div>
		<!--/工具栏-->
		
		<!--搜索栏-->
		<form:form id="searchForm" modelAttribute="section" action="${ctx}/sd/section" method="post">
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
			<div class="det-list clearfix">
			    <div class="group btm">
					<div class="control">
			            <div class="title">抽奖名称</div>
			            <form:input path="name" htmlEscape="false" cssClass="input normal"/>
			        </div>
			    </div>   
			    <div class="group searchbtn">
			        <div class="btn-list">
			            <input type="submit" name="btnDetailedSearch" value="查询" id="btnDetailedSearch" class="btn">
			            <input name="btnReturn" type="reset" value="重置" class="btn yellow">
			        </div>
			    </div>
			    <div style="clear:both;"></div>
			</div>
		</form:form>
		<!--/搜索栏-->
		
		<!--列表-->
		<div class="table-container">
			<table class="flexgrid" >
				<thead>
					<tr>
						<th width="25" align="center">选择</th>
						<th width="100" align="center">抽奖名称</th>
						<th width="150" align="center">抽奖时间</th>
						<th width="50" align="center">抽奖概率</th>								
						<th width="1000" align="center">奖品详细</th>				
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${page.list}" var="section">
					<tr>
						<td style="text-align:center;">
							<span class="checkall" style="vertical-align: middle;">
								<input type="checkbox" name="checkall" value="${section.id}" />
							</span> 
							<%-- <input type="hidden" name="checkall" value="${awardsection.id}" /> --%>
						</td>
						<td  ><a style="position: relative;top: 33px;" href="${ctx}/sd/section/form?id=${section.id}">${section.name}</a></td>
						<td class="section-date"><div style="position: relative; top: 9px;" ><fmt:formatDate value="${section.startOn}" pattern="yyyy-MM-dd HH:mm"/><br>~<br><fmt:formatDate value="${section.endOn}" pattern="yyyy-MM-dd HH:mm"/></div></td>	
						<td><div style=" position: relative;top: 25px;">${section.globalRate}</div></td>																	
						<td >
						<div style="position: relative; top: 4px;">
							<table style="width: 1000px;height: 50px;" >
								<tbody >
									<c:forEach items="${section.sections}"  var="content" >
										<div class="section-table">
											<p class="section-table-p1">${content.award.name }</p>
											<p class="section-table-p2">数量:&nbsp;${content.amount}</p>
										</div>
									</c:forEach>
								</tbody>
							</table>
							</div>
						</td>
						</tr>
				</c:forEach>
				</tbody>
			</table>
		</div>
	</body>
</html>
